package cn.anecansaitin.jep.parser.ast.node.expression.literal;

import cn.anecansaitin.jep.Token;
import cn.anecansaitin.jep.TokenType;
import cn.anecansaitin.jep.types.TypeInfo;

public final class DoubleLiteral extends Literal {
    private final double value;

    public DoubleLiteral(Token doubleToken) {
        this(doubleToken.value(), doubleToken.line(), doubleToken.column());
    }

    public DoubleLiteral(String value, int line, int column) {
        super(TokenType.DOUBLE_LITERAL, TypeInfo.DOUBLE, line, column);
        this.value = Double.parseDouble(value);
    }

    public double value() {
        return value;
    }
}